package com.dhcc.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 * @author
 * @version 1.0 Function: 公共类
 */
public class CommonUtils {

    /**
     * 生成主键UUID
     */
    public static String getUUID() {
        String uuid = UUID.randomUUID().toString().replaceAll("-", "");
        return uuid;
    }

    /**
     * yyyyMMddHHmmss
     */
    public static String getNowTime() {
        String nowTime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
        return nowTime;
    }

    /**
     * yyyyMMdd
     */
    public static String getNowTimeTillDay() {
        String nowTime = new SimpleDateFormat("yyyyMMdd").format(new Date());
        return nowTime;
    }

    /**
     * yyyy-MM-dd HH:mm:ss
     */
    public static String getNowTimeDetail() {
        String nowTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
        return nowTime;
    }

    /**
     * yyyy-MM-dd
     */
    public static String getNowDetail() {
        String nowTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
        return nowTime;
    }

    /**
     * yyyy-MM
     */
    public static String getNowYearMonth() {
        String nowTime = new SimpleDateFormat("yyyy-MM").format(new Date());
        return nowTime;
    }

}
